<template>
  <van-uploader
    class="mg-l"
    accept=""
    :after-read="upload_file"
  >
    <slot></slot>
  </van-uploader>
</template>

<script>
  import { headers } from "../../utils/request";
  import xlsx from "xlsx";

  export default {
    components: {},
    props: {
      text:String,
      http_api:{
        default: "VITE_APP_API"
      },
      http_url:{
        default: "/v1/upload/img"
      }
    },
    data() {
      return {
        headers: headers(),
        clipboard:null,
        upload_url:""
      };
    },
    computed: {
    },
    mounted() {
      this.upload_url = import.meta.env[this.http_api] + this.http_url;
    },
    methods: {
      async upload_file(event,file){
        
      },
      // excelUploadFail(err) {
      //   this.$message(JSON.parse(err.message));
      //   this.$emit("onError",err)
      // },
      // async excelUploadSuccess(res,file) {
      //   this.$message("导入成功");
      //   this.$emit("onSuccess",res,file)
      // },

      // readFile(file) {
      //   return new Promise(resolve => {
      //     let reader = new FileReader()
      //     reader.readAsBinaryString(file)
      //     reader.onload = ev => {
      //       resolve(ev.target.result)
      //     }
      //   })
      // }
    }
  };
</script>
<style scoped lang='less'>

</style>
<style lang='less'>

</style>